<template>
    <div>
        <Row>
            <Row :gutter="12">
                <i-col span="24">
                    <Row>
                        <Card>
                            <p slot="title">
                                <Icon type="person"></Icon>
                                申请详情
                            </p>
                            <Form ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="80">

                                <FormItem label="真实姓名">
                                    <p>{{check.info.true_name}}</p>
                                </FormItem>
                                <FormItem label="身份证号">
                                    <p>{{check.info.id_card_code}}</p>
                                </FormItem>
                                <FormItem label="地址">
                                    <p>{{check.info.address}}
                                        <Button style="margin-left: 16px" shape="circle" icon="ios-navigate"></Button>
                                    </p>
                                    <div class="map">

                                    </div>
                                </FormItem>
                                <FormItem label="资质证明">
                                    <p><img :src="host+check.info.prove" class="photo-item"/></p>
                                </FormItem>
                                <FormItem label="身份证正面">
                                    <p><img :src="host+check.info.id_card_for" class="photo-item"/></p>
                                </FormItem>
                                <FormItem label="身份证反面">
                                    <p><img :src="host+check.info.id_card_back" class="photo-item"/></p>
                                </FormItem>
                                <FormItem label="手持身份证">
                                    <p><img :src="host+check.info.handle_card" class="photo-item"/></p>
                                </FormItem>
                                <FormItem label="服务类别">
                                    <Tag :key="item.id" color="blue" v-for="item in check.service_types_array">
                                        {{item.name}}
                                    </Tag>
                                </FormItem>
                                <FormItem label="备注" prop="remark">
                                    <Input type="textarea" v-model="formValidate.remark" placeholder="请输入备注"></Input>
                                </FormItem>

                                <FormItem>
                                    <Button @click="onSubmitClick" :loading="$store.state.loading" type="primary">审核通过
                                    </Button>
                                    <Button type="ghost" style="margin-left: 8px">驳回审核
                                    </Button>
                                </FormItem>
                            </Form>
                        </Card>
                    </Row>

                </i-col>
            </Row>
        </Row>
    </div>
</template>
<script type="text/jsx">

  import url from '../../config/url'
  import time from '../../libs/time'
  import utils from '../../libs/util'

  export default {
    name: 'user_update_check_detail',
    data () {
      return {
        id: 0,
        check: {
          info: {}
        },
        host: url.host,
        formValidate: {
          remark: ''
        },
        ruleValidate: {}
      }
    },
    mounted () {
      console.log(this.$route.params)
      this.check = this.$route.params.item
      this.id = this.$route.params.id
    },
    methods: {
      onSubmitClick () {
        this.$store.commit('setLoading', {loading: true})
        $api.post(`${url.check}/${this.id}`,{remark:this.formValidate.remark})
          .then((res)=>{
            this.$store.commit('setLoading', {loading: false})
            if (res.status) {
              this.$Message.success('更新成功')
              util.closeCurrentPage(this, 'user_update_check_detail')
            }
          })
          .catch((error)=>[

        ])
      }
    }
  }
</script>
<style lang="less" scoped="">
    .photo-item {
        width: 400px;
        height: auto;
    }
</style>